package com.atguigu.guigu.common.exception;
/*
    编译时异常：
        代码编译不通过，必须处理该异常 try catch

    运行时异常：
        编译时检查不出来，代码运行时可能会出现的异常
        可以抛出无需处理
 */

import com.atguigu.guigu.common.result.ResultCodeEnum;
import lombok.Getter;

@Getter
public class BusinessException extends RuntimeException{

    private Integer code;
    private String message;

    public BusinessException(Integer code,String message){
        this.code = code;
        this.message = message;
    }
    public BusinessException(Integer code,String message,Exception e){
        super(e);
        this.code = code;
        this.message = message;
    }
    public BusinessException(ResultCodeEnum codeEnum){
        this.code = codeEnum.getCode();
        this.message = codeEnum.getMessage();
    }
    public BusinessException(ResultCodeEnum codeEnum,Exception e){
        super(e);
        this.code = codeEnum.getCode();
        this.message = codeEnum.getMessage();
    }
}
